package com.sino.struts2;

import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.sino.business.IZlbhzkService;
import com.sino.model.ZlbhzkModel;

public class ZlbhzkAction extends ActionSupport{
	
	private IZlbhzkService zlbhzkService = null;
	
	private ZlbhzkModel zlbhzkModel = null;
	private String zlid;
	
	public String getZlid() {
		return zlid;
	}
	public void setZlid(String zlid) {
		this.zlid = zlid;
	}
	//------------------------显示专利保护状况
	public String viewZlbhzk(){
		return this.SUCCESS;
	}
	//------------------------保存专利保护状况
	public String saveZlbhzk(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid");
		zlbhzkModel.setZlid(zlId);
		this.getZlbhzkService().saveZlbhzk(zlbhzkModel);
		return this.SUCCESS;
	}
	//------------------------更新专利保护状况
	public String updateZlbhzk(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid2");
		zlbhzkModel.setZlid(zlId);
		this.getZlbhzkService().saveZlbhzk(zlbhzkModel);
		return this.SUCCESS;
	}
	//------------------------查找专利保护状况
	public String findZlbhzk(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid");
		this.setZlbhzkModel(this.getZlbhzkService().findZlbhzkById(zlId));
		return this.SUCCESS;
	}
	
	public String findZlbhzkToPrint(){
		
		this.setZlbhzkModel(this.getZlbhzkService().findZlbhzkById(zlid));
		return this.SUCCESS;
	}	
	//------------------------查找专利保护状况---用于更新
	public String findUpdateZlbhzk(){
		HttpSession session = ServletActionContext.getRequest().getSession();
		String zlId = (String)session.getAttribute("zlid2");
		this.setZlbhzkModel(this.getZlbhzkService().findZlbhzkById(zlId));
		return this.SUCCESS;
	}
	//------------------------接口
	public ZlbhzkModel getZlbhzkModel() {
		return zlbhzkModel;
	}
	public void setZlbhzkModel(ZlbhzkModel zlbhzkModel) {
		this.zlbhzkModel = zlbhzkModel;
	}
	public IZlbhzkService getZlbhzkService() {
		return zlbhzkService;
	}
	public void setZlbhzkService(IZlbhzkService zlbhzkService) {
		this.zlbhzkService = zlbhzkService;
	}
	
}
